#指定运行此配置文件所需的 CMake 的最低版本
cmake_minimum_required(VERSION 3.4.1)
#设置项目名称
project (Lesson1)

#set(CXX_FLAGS
#        -g
#         -DVALGRIND
#        -DCHECK_PTHREAD_RETURN_VALUE
#        -D_FILE_OFFSET_BITS=64
#        -Wall
#        -Wextra
#        -Werror
#        -Wconversion
#        -Wno-unused-parameter
#        -Wold-style-cast
#        -Woverloaded-virtual
#        -Wpointer-arith
#        -Wshadow
#        -Wwrite-strings
#        -march=native
#         -MMD
#        -rdynamic
#        )
#string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
#string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

#set(CMAKE_BUILD_TYPE DEBUG)
#set(CMAKE_C_FLAGS "-O0 -ggdb")
#set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb")
#set(CMAKE_C_FLAGS_RELEASE "-O0 -ggdb")
#set(CMAKE_CXX_FLAGS "-O0 -ggdb")
#set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
#set(CMAKE_CXX_FLAGS_RELEASE "-O0 -ggdb")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb")


find_library( # Defines the name of the path variable that stores the
        # location of the NDK library.
        log-lib
        # Specifies the name of the NDK library that
        # CMake needs to locate.
        log )

add_library( # Specifies the name of the library.
        native-lib
        # Sets the library as a shared library.
        SHARED
        # Provides a relative path to your source file(s).
        native-lib.cpp )

# Specifies a path to native header files.
include_directories(include/)

# Links your native library against one or more other native libraries.
target_link_libraries( # Specifies the target library.
        native-lib
        # Links the log library to the target library.
        ${log-lib} )

#编译成一个名称为native-exe的可执行文件
add_executable(native-exe native-lib.cpp)